<?php
/**
 * Filename: Soy.php
 * 调料 豆浆，继承于 CondimentDecrator
 */
include_once 'Condiment.php';

/**
 * 豆浆
 */
class Soy extends CondimentDecorator {
	/**
	 * 饮料对象
	 *
	 * @var Beverage
	 */
	private $beverage;
	
	/**
	 * 传入饮料对象
	 *
	 * @param Beverage $beverage
	 */
	public function __construct(Beverage $beverage) {
		$this->beverage = $beverage;
	} //END func __construct

	/**
	 * @see Beverage::cost()
	 *
	 */
	public function cost() {
		$cost = $this->beverage->cost();
		switch ($this->beverage->getSize()) {
			case -1:
				return 0.10 + $cost; 
				//break;
			case 0:
				return 0.15 + $cost;
			case 1:
				return 0.20 + $cost;
			default:
				return $cost;
		} //END switch coffe size
	} //END func cost
	
	/**
	 * @see CondimentDecorator::getDescription()
	 *
	 * @return string
	 */
	public function getDescription() {
		return $this->beverage->getDescription().', Soy';
	} //END func getDescription

} //END class Soy
?>